//票据收取机
function Check_Readeroninit(){
	var rc = bommADMDevControl.ReaderOninit({"r_lTimeOut":0});
	if(rc == "0") {
		var setform = Check_ReaderSetForm();
		if(setform == "0"){
			return '0';
		} else {
			return '-1';
		}
	} else {
		return '-1';
	}
}

function Check_ReaderReadForm(formkey){
	if(formkey == "0") {//0 表示 要拿到正面影像全路径
		//获取影像的正面图像全路径
		var frontIMGPath = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":FrontIMGPath,"r_lTimeOut":0});
		if(frontIMGPath == "") {
			//没有找到图像
			return '-1';
		}
		return frontIMGPath;
	}
	
	if(formkey == "1") {//1 表示 要拿到背面影像全路径
		//获取影像的背面图像全路径
		var rearIMGPath = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":RearIMGPath,"r_lTimeOut":0});
		if(rearIMGPath == "") {
			//没有找到图像
			return '-1';
		}
		return rearIMGPath;
	}
	
	if(formkey == "2") {//2 表示要拿到MICR识读内容
		//获取MICR识读内容
		var micrReaded = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":MICRReaded,"r_lTimeOut":0});
		if(micrReaded == "") {
			//没有找到MICRReaded识读内容
			return '-1';
		}
		return micrReaded;
	}
	
	if(formkey == "3") {//3 表示要拿到OCR识读内容
		//获取OCR识读内容
		var ocrReaded = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":OCRReaded,"r_lTimeOut":0});
		if(ocrReaded == "") {
			//没有找到OCR识读内容
			return '-1';
		}
		return ocrReaded;
	}
	
	if(formkey == "4") {//4表示判断影像
		var imgCheckResult = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":IMGCheckResult,"r_lTimeOut":0});
		return imgCheckResult;
	}
	
	if(formkey == "5") {//5 二维码识别
		var qrCode = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":QRCode,"r_lTimeOut":0});
		return qrCode;
	}
	
	if(formkey == "6") {//失败信息
		var imgCheckResultDesc = bommADMDevControl.ReaderReadForm({"r_lpReaderForm":"","r_FormKey":IMGCheckResultDesc,"r_lTimeOut":0});
		return imgCheckResultDesc;
	}
}

function Check_ReaderSetForm(){
	var readersetform_filePathF = bommADMDevControl.ReaderSetForm({"r_bstrFormName":"", "r_FormKey":"FilePathF", "r_FormValue":"C:\\Images\\", "r_lTimeOut":0});
	var readersetform_filePathR = bommADMDevControl.ReaderSetForm({"r_bstrFormName":"", "r_FormKey":"FilePathR", "r_FormValue":"C:\\Images\\", "r_lTimeOut":0});
	var readersetform_frontside = bommADMDevControl.ReaderSetForm({"r_bstrFormName":"", "r_FormKey":"FrontsideCamera", "r_FormValue":"1", "r_lTimeOut":0});
	var readersetform_rearside = bommADMDevControl.ReaderSetForm({"r_bstrFormName":"", "r_FormKey":"RearsideCamera", "r_FormValue":"1", "r_lTimeOut":0});
	if(readersetform_frontside == "0" && readersetform_rearside == "0" && readersetform_filePathR == "0" && readersetform_filePathF == "0") {
		return '0';
	} else {
		return '-1';
	}
}

function Check_Readerprocessform(){
	var rc = bommADMDevControl.ReaderProcessForm({"r_lpFormName":"", "r_lTimeOut":0});
	alert(rc);
	return rc;
}

function Check_ReaderAcceptDoc(r_bIsAccept){
	var rc = bommADMDevControl.ReaderAcceptDoc({"r_bIsAccept":r_bIsAccept, "rLTimeOut":0});
	return rc;
}

function Check_ReaderCancelJob(){
	var rc = bommADMDevControl.ReaderCancelJob({"r_lTimeOut":0});
	return rc;
}

//打开票据口
function Check_Readerputdoc(time){
	var rc = bommADMDevControl.ReaderPutDoc({"r_lTimeOut":time});
	return rc;
}
var iResult;

//监听事件
function nonStandardOcxEventResult(eventname,result,value){
	index.nonStandardOcxEventResult(eventname,result,value);
}

function getIResult() {
	return iResult;
}
function Check_Readerretractdoc(time){
	var rc = bommADMDevControl.ReaderRetractDoc({"r_lTimeOut":time});
	return rc;
}

function Check_Readercloseshutter(){
	var rc = bommADMDevControl.ReaderCloseShutter({"r_lTimeOut":0});
	return rc;
}
